﻿///***************************************************************
/// 시  스  템 : Updms.Com.Dac
/// 단위시스템 : COM
/// 계      층 : Data Access Layer
/// 프로그램명 : Com_Dac_UPDMS_COM_USER_MGT
/// 파  일  명 : Com_Dac_UPDMS_COM_USER_MGT.cs
/// 설      명 : 사용자관리
///***************************************************************
/// 수정ID 일자       이름     내용
///---------------------------------------------------------------
/// CH001  2008-07-28 송시명   최초 작성
///***************************************************************
using System.Data;
using System.Data.SqlClient;
using System.EnterpriseServices;
using System.Runtime.InteropServices;

using SMFramework.Data;


namespace Updms.Com.Dac
{
	[ComVisible(true)]
	[Transaction(TransactionOption.Supported)]
	[JustInTimeActivation(true)]
	public class Com_Dac_UPDMS_COM_USER_MGT : Base.AppFramework.DacBase
	{
		public Com_Dac_UPDMS_COM_USER_MGT()
		{
		}

		#region NT [GetSearchCount]
		
		[AutoComplete]
		public int GetSearchCount(DataPack lo_dp)
		{
			string strSql = "usp_UPDMS_COM_USER_MGT_Get_Search_Count";
			
			SqlParameter[] paramArray = lo_dp.ToSqlParameters();
			
			return (int)_agent.ExecuteScalar(strSql, paramArray, CommandType.StoredProcedure);
		}
		
		#endregion

		#region NT [SelectProcess]
		
		[AutoComplete]
		public DataSet SelectProcess(DataPack lo_dp)
		{
			string strSql = "usp_UPDMS_COM_USER_MGT_Select_Paging";

			SqlParameter[] paramArray = lo_dp.ToSqlParameters();

			DataSet ds = new DataSet();
			return _agent.Fill(strSql, "UPDMS_COM_USER_MGT", ds, paramArray, CommandType.StoredProcedure);
		}
		
		#endregion		
	
		#region NT [SelectByUserId]

		/// <summary>
		/// 개인정보수정 - 조회
		/// </summary>
		/// <param name="ls_user_id"></param>
		/// <returns>DataSet</returns>
		[AutoComplete]
		public DataSet SelectByUserId(DataPack lo_dp)
		{
			string strSql = "usp_UPDMS_COM_USER_MGT_Select_By_User_Id";

			SqlParameter[] paramArray = lo_dp.ToSqlParameters();

			DataSet ds = new DataSet();
			return _agent.Fill(strSql, "UPDMS_COM_USER_MGT", ds, paramArray, CommandType.StoredProcedure);
		}
		
		#endregion		

		#region NT [SearchUserInfo]

		/// <summary>
		/// 인원조회
		/// </summary>
		/// <param name="lo_dp"></param>
		/// <returns></returns>
		[AutoComplete]
		public DataSet SearchUserInfo(DataPack lo_dp)
		{
			string strSql = "usp_UPDMS_COM_USER_MGT_Search_User_Info";

			SqlParameter[] paramArray = lo_dp.ToSqlParameters();

			DataSet ds = new DataSet();
			return _agent.Fill(strSql, "UPDMS_COM_USER_MGT", ds, paramArray, CommandType.StoredProcedure);
		}

		#endregion		

		#region NT [CheckExistUserId]

		/// <summary>
		/// 아이디중복체크 - 존재하는 아이디 이면 true
		/// </summary>
		/// <param name="ls_user_id"></param>
		/// <returns></returns>
		[AutoComplete]
		public bool CheckExistUserId(string ls_user_id)
		{
			bool lb_result = false;
			string ls_sql = "usp_UPDMS_COM_USER_MGT_Check_Exist_User_Id";

			SqlParameter[] paramArray =
			{
				new SqlParameter("ls_user_id", ls_user_id)
			};

			int li_rslt = (int)_agent.ExecuteScalar(ls_sql, paramArray, CommandType.StoredProcedure);

			lb_result = (li_rslt > 0);

			return lb_result;
		}

		#endregion		
		
		

		#region RT [Insert]
		
		[AutoComplete]
		public int Insert(DataPack lo_dp)
		{
			string strSql = "usp_UPDMS_COM_USER_MGT_Insert";

			SqlParameter[] paramArray = lo_dp.ToSqlParameters();
			return _agent.ExecuteNonQuery(strSql, paramArray, CommandType.StoredProcedure);
		}
		
		#endregion

		#region RT [Update]
		
		[AutoComplete]
		public int Update(DataPack lo_dp)
		{
			string strSql = "usp_UPDMS_COM_USER_MGT_Update";			
			
			SqlParameter[] paramArray = lo_dp.ToSqlParameters();
			return _agent.ExecuteNonQuery(strSql, paramArray, CommandType.StoredProcedure);
		}
		
		#endregion

		#region RT [Delete]
		
		[AutoComplete]
		public int Delete(string ls_xml)
		{
			string strSql = "usp_UPDMS_COM_USER_MGT_Delete";

			SqlParameter[] paramArray =
			{
				new SqlParameter("ls_xml", ls_xml)
			};
			
			return _agent.ExecuteNonQuery(strSql, paramArray, CommandType.StoredProcedure);
		}
		
		#endregion
		
		#region RT [UpdateByUserId]

		/// <summary>
		/// 개인정보수정 - 수정
		/// </summary>
		/// <param name="lo_dp"></param>
		/// <returns>int</returns>
		[AutoComplete]
		public int UpdateByUserId(DataPack lo_dp)
		{
			string strSql = "usp_UPDMS_COM_USER_MGT_Update_By_User_Id";

			SqlParameter[] paramArray = lo_dp.ToSqlParameters();
			return _agent.ExecuteNonQuery(strSql, paramArray, CommandType.StoredProcedure);
		}

		#endregion

		#region RT [UpdatePassword]

		/// <summary>
		/// 개인정보수정 - 비밀번호수정
		/// </summary>
		/// <param name="lo_dp"></param>
		/// <returns>int</returns>
		[AutoComplete]
		public int UpdatePassword(DataPack lo_dp)
		{
			string strSql = "usp_UPDMS_COM_USER_MGT_Update_Password";

			SqlParameter[] paramArray = lo_dp.ToSqlParameters();
			return _agent.ExecuteNonQuery(strSql, paramArray, CommandType.StoredProcedure);
		}

		#endregion

		#region RT [InitPassword]

		/// <summary>
		/// 사용자관리 - 비밀번호수정
		/// </summary>
		/// <param name="lo_dp"></param>
		/// <returns>int</returns>
		[AutoComplete]
		public int InitPassword(DataPack lo_dp)
		{
			string strSql = "usp_UPDMS_COM_USER_MGT_Init_Password";

			SqlParameter[] paramArray = lo_dp.ToSqlParameters();
			return _agent.ExecuteNonQuery(strSql, paramArray, CommandType.StoredProcedure);
		}

		#endregion
	}
}
